{block name="style"}
{/block}
{block name="content"}
<form class="layui-form" action="{:url('/wms/recv/purchase_recv')}" method="post" id="purchase-recv">
    <input type="hidden" name="is_track" value="{$is_track}">
    <input type="hidden" name="purchase_id" value="{$purchase.purchase_id}">
    <input type="hidden" name="po" value="{$po}">
    <div class="info-header">
        <div class="layui-row">
            <div class="layui-col-xs3">
                <label class="layui-form-label">采购单号</label>
                <div class="layui-input-block">
                    <input type="text" value="{$purchase.purchase_sn}" readonly class="layui-input copy-text">
                </div>
            </div>
            <div class="layui-col-xs3">
                <label class="layui-form-label">供应商</label>
                <div class="layui-input-block">
                    <input type="text" value="{$purchase.producer.name}" readonly class="layui-input">
                </div>
            </div>
            <div class="layui-col-xs3">
                <label class="layui-form-label">采购人</label>
                <div class="layui-input-block">
                    <input type="text" value="{$purchase.buyer.nickname}" readonly class="layui-input">
                </div>
            </div>
            <div class="layui-col-xs3">
                <label class="layui-form-label">调入仓库</label>
                <div class="layui-input-block">
                    <input type="text" value="{$purchase.warehouse.name}" readonly class="layui-input">
                </div>
            </div>
        </div>
        <div class="layui-row">
            {if $is_track}
            <div class="layui-col-xs3">
                <label class="layui-form-label">追踪号</label>
                <div class="layui-input-block">
                    <input type="text" value="{$po}" readonly class="layui-input copy-text">
                </div>
            </div>
            {/if}
            <div class="layui-col-xs3">
                <label class="layui-form-label">备注信息</label>
                <div class="layui-input-block">
                    <input type="text" value="{$is_track ? $temp.remark : $purchase.remark}" readonly class="layui-input">
                </div>
            </div>
        </div>
    </div>
    <div class="info-body">
        <div class="layui-row" style="margin-top: 30px;">
            <h2>商品详情</h2>
            <table class="layui-table text-center">
                <thead>
                <tr>
                    <th>图片</th>
                    <th>名称</th>
                    <th>SKU</th>
                    <th>到货数量</th>
                    <th>异常数量</th>
                    <th>异常类型</th>
                    <th>单位</th>
                    <th>单价</th>
                    <th>备注</th>
                </tr>
                </thead>
                <tbody>
                {php}if($is_track)$purchase=$temp;{/php}
                {foreach $purchase->info as $info}
                {php}$qty = isset($info->n_store_qty) ? $info->n_store_qty : $info->qty; if($qty < 1)continue;{/php}
                <tr>
                    <td width="100"><img src="{$info.image_url}"></td>
                    <td>{$info.name_ch}</td>
                    <td>
                        <span class="copy-text">{$info.sku}</span>
                        <input type="hidden" class="purchase-sku" name="sku[]" value="{$info.sku}"/>
                    </td>
                    <td width="150">
                        <input type="number" class="purchase-qty layui-input" name="qty[]" value="{$qty}">
                        <input type="hidden" name="sqty[]" value="{$qty}">
                    </td>
                    <td width="150">
                        <input type="number" class="purchase-ex-qty layui-input" name="ex_qty[]" value="0">
                    </td>
                    <td class="text-left">
                        <select name="ex_type[]" class="purchase-ex-type">
                            <option value="">请选择</option>
                            {foreach $ex_type as $k=>$v}
                            <option value="{$k}">{$v}</option>
                            {/foreach}
                        </select>
                    </td>
                    <td>{$info.unit}</td>
                    <td>{$info.price|abs}</td>
                    <td><input type="text" name="remark[]" class="purchase-remark layui-input" value="{$info.remark}"></td>
                </tr>
                {/foreach}
                </tbody>
            </table>
        </div>
    </div>
</form>
{/block}
{block name="script"}
{/block}